<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCoursesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('courses', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title')->comment('课程名称');
            $table->text('description')->comment('课程介绍')->nullable();
            $table->longText('content')->comment('内容')->nullable();
            $table->tinyInteger('content_type')->comment('内容类型，0=富文本|1=视频')->default(0);
            $table->tinyInteger('course_type')->comment('课程类型，0=主线任务|1=支线次要任务|2=实践任务')->default(0);
            $table->unsignedInteger('exp')->comment('经验值')->default(0);
            $table->unsignedInteger('depth')->comment('深度值')->default(0);
            $table->json('complete_conditions')->comment('完成条件')->nullable();
            $table->json('event')->comment('触发事件')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('courses');
    }
}
